<template>
  <div class="mask">
    <div class="preview">
      <div class="title">事件预览</div>
      <div class="close" @click="$emit('close')">
        <img src="../../assets/close.svg" alt="">
      </div>
      <div class="content">
        <div class="name">事件名称：{{ taskData?.taskName }}</div>
        <div class="time">{{ dayjs(taskData?.time)?.format('YYYY-MM-DD HH:mm:ss') }}</div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import {defineEmits} from "vue";
import dayjs from 'dayjs'

defineEmits(['close'])
type Task = {
  taskID: string,
  taskName: string,
  checked: boolean,
  time: number
}
type Props = {
  taskData?: Task,
}
defineProps<Props>()

</script>

<style scoped lang="less">
.mask {
  background-color: rgba(0, 0, 0, 0.5);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;

  .preview {
    color: #333;
    box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.3);
    background-color: #fff;
    border-radius: 1rem;
    width: 50vw;
    min-height: 20vh;
    z-index: 2;
    position: relative;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    user-select: none;
    border: 1px solid transparent;
    padding-bottom: 2rem;

    .title {
      font-size: 1.5rem;
      margin-top: 1rem;
      text-align: center;
    }

    .content {
      padding: 20px;
      .name{
        letter-spacing: 3px;
        line-height: 22px;
      }

      .time {
        margin-top: 20px;
        text-align: right;
      }
    }

    .close {
      position: absolute;
      top: 1rem;
      right: 1rem;
      cursor: pointer;
    }
  }
}
</style>